package com.wejoy.video.middle.station.data.enums.dict;

/**
 * 数据状态枚举
 *
 * @author admin
 */
public enum EnumStatus {
    /**
     * The new.
     */
    NEW(0, "新增"),

    AUDIT(1, "已审核"),

    RELEASE(2, "已发布"),

    RECORD(3, "已归档"),

    DENY_AUDIT(4, "未通过审核"),

    DEL(-9, "已删除");

    private Integer code;
    private String text;
    EnumStatus(Integer code, String text) {
        this.code = code;
        this.text = text;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    /**
     * 通过code获得该枚举类型
     *
     * @param code
     * @return
     */
    public static EnumStatus getByCode(Integer code) {
        EnumStatus[] values = EnumStatus.values();
        for (EnumStatus type : values) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        return NEW;
    }
}
